<template>
    <div>
        <h2>账号列表</h2>

        <table class="table table-bordered">
            <tbody>

                <tr>
                    <td>序号</td>
                    <td>姓名</td>
                    <td>手机号</td>
                    <td>账号</td>
                    <td>密码</td>
                    <td>所属角色</td>
                    <td>创建人</td>
                </tr>

                <tr v-for="item in data.list" :key="item.Id">
                    <td>{{item.Id}}</td>
                    <td>{{item.Fname}}</td>
                    <td>{{item.Phone.substring(0,3)+"****"+item.Phone.substring(0,4)}}</td>
                    <td>{{item.Name}}</td>
                    <td>****</td>
                    <td>{{item.Rowls}}</td>
                    <td>{{item.Create}}</td>
                </tr>

            </tbody>
        </table>

    </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue'
import axios from 'axios';
import { useRouter,useRoute } from 'vue-router';
import {useUserStore} from '@/stores/user'

const a = useUserStore();

let router = useRouter();
let route = useRoute();


let list:any=reactive({
    PageIdenx:1,
    PageSizer:10,
    Name:''
})

let data:any=reactive({
    list:[],
    totaCount:0,
    totaPage:0
})

onMounted(()=>{
    if(a.userInfo.Id)
    {
        showall();
    }
    else
    {
        router.push('/admin');
    }
    
})


const showall=()=>{
    axios({
        url:'http://localhost:5277/api/Admin/ShowAdmin',
        method:'get',
        params:list
    })
    .then((res)=>{
        Object.assign(data,res.data)
    })
    .catch((err)=>{
        console.log(err)
    })
}







</script>

<style scoped>

</style>